from pynput.keyboard import Controller, Key
from pynput.mouse import Button, Controller as MouseController
import time

keyboard = Controller()
mouse = MouseController()

while True:
    try:
        time.sleep(3)  # 暂停三秒
        print("hh")

        keyboard.press('a')  # 按下 'a' 键
        keyboard.release('a')  # 释放 'a' 键

        keyboard.press(Key.enter)  # 按下 Enter 键
        keyboard.release(Key.enter)  # 释放 Enter 键

        mouse.click(Button.left)  # 在当前位置执行左键单击
    except Exception as e:
        print(f"An error occurred: {e}")
a
a
